import java.util.Random;
import java.util.Scanner;

public class GuessNumberGame {
    public static void main(String[] args) {
        Random rand = new Random();
        int numberToGuess = rand.nextInt(100) + 1; // Generates a random integer between 1 and 100 inclusive.
        Scanner scanner = new Scanner(System.in);
        
        while (true) { 
            System.out.println("请输入您猜测的数字:");
            if (!scanner.hasNextInt()) {
                System.out.println("这不是有效的数字，请重新尝试.");
                scanner.next();  
                continue;
            }
            
            int guess = scanner.nextInt();

            if (guess < numberToGuess)
                System.out.println("太小了");
            else if (guess > numberToGuess)
                System.out.println("太大了");
            else {
                System.out.println("恭喜你，猜对了！");
                break;
            }
        }

        scanner.close();
    }
}